﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MapEditor
{
    public partial class FormAdv : Form
    {
        public bool DrawInALine;
        public Point StartDrawPosition;
        public int NumberObj;
        private Form1 mainForm = null;

        public FormAdv(Form callingForm)
        {
            mainForm = callingForm as Form1;
            InitializeComponent();

            rb_h.Checked = true;
            DrawInALine = true;
        }

        private void button_cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }


        private void button_ok_Click(object sender, EventArgs e)
        {
            if (tb_formposX.Text != "" && tb_fromposY.Text != "" && tb_num.Text != "")
            {
                try
                {
                    StartDrawPosition.X = int.Parse(tb_formposX.Text);
                    StartDrawPosition.Y = int.Parse(tb_fromposY.Text);
                    NumberObj = int.Parse(tb_num.Text);

                    if (rb_h.Checked) DrawInALine = true;
                    else DrawInALine = false;
                    this.mainForm.AddAdvanceObject();
                    this.Close();
                }
                catch (System.FormatException)
                {
                    MessageBox.Show("Invalid Information. Please correct!");
                }
            }
            else MessageBox.Show("Please fill out this form!");
        }
    }
}
